
In the JavaScript have this keyword. This keyword basically referees the won property. When we call this keyword then we use the property which is present under the scope. When we use the same name as a variable one is present under a scope and another is out of scope then how can identify which is under the scope and which is the out of the scope. Now we use this keyword to identify. When use this keyword then this is the under the scope variables. Also, when we use this keyword then it prefers object won property. Now given bellow the example code and explain the code:
<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body>
<script type="text/javascript">
// JavaScript this keyword
let myProparty={
day:'Monday',
meeting:0,
meetDone:0,
dddMeeting:function(){
console.log("Yes i can do!");
//use this keyword
console.log(this);
}
}
myProparty.dddMeeting();
</script>
</body>
</html>
In this JavaScript code we see how to work this keyword. When we use this keyword into our object under “console.log” function then this keyword represents our own property of the object. So, we can say this keyword represent the won property of the object or which scope under present.